﻿using System;
using System.Collections.Generic;
using System.Web.Services;
using BLL;
using BLL.RF.TestRecord;
using Model;
using Model.RF.TestRecord;

/// <summary>
///Action_Record_ATEFlowControlCheck_Service 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。 
// [System.Web.Script.Services.ScriptService]
public class Action_Record_ATEFlowControlCheck_Service : System.Web.Services.WebService
{
    private ProductType p;
    private ProductType_Flow pf;
    private Action_Record ar;

    public Action_Record_ATEFlowControlCheck_Service()
    {
        p = new ProductType();
        pf = new ProductType_Flow();
        ar = new Action_Record();
        //如果使用设计的组件，请取消注释以下行 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }

    [WebMethod(Description = "判断产品类型S代码是否合法")]
    public bool IsValidProductTypeID(string productTypeID)
    {
        return !string.IsNullOrEmpty(p.LoadEntity(productTypeID).ProductTypeID);
    }

    [WebMethod(Description = "判断ATE前工序是否有合格数据，在使用中兴矩阵开关测试软件前使用，返回false则提示不允许测试")]
    public bool ProductType_Flow_HasValidSevenStep_ForATEStep(string productSN, string productTypeID)
    {
        return pf.ProductType_Flow_HasValidSevenStep(productSN, productTypeID, "ATEStep");
    }

    [WebMethod(Description = "检测记录上传。序列号，S代码，工号，客户端IP，结果必须赋值；ID，时间，备注，操作类型可以不管；上传成功返回true，否则返回false")]
    public bool ATEFlowControlCheck_Add(Action_RecordInfo tri)
    {        
        tri.ID = 0;
        tri.RecordTime = DateTime.Now;
        tri.Remark = "";
        tri.ProductSN = CommHelper.GetProductSN(tri.ProductSN);
        return ar.Action_Record_Insert_ATEFlowControlCheck(tri); 
    }
}

